<?php

/**
 * Class mailConfiguration.php
 *
 * class that processes the email sent. Is supported by the class PHPMailer
 */

function sendMail($subject, $to, $message){

	$mail=new PHPMailer();

	$mail->IsSMTP(); // send via SMTP
	$mail->Host = "smtp-servers.ua.pt";
	$mail->Port = 25; // SMTP servers
	$mail->SMTPAuth = true; // turn on SMTP authentication
	$mail->Username = "de-arguquest@ua.pt"; // SMTP username
	$mail->Password = "brasil"; // SMTP password
	$mail->From = "de-arguquest@ua.pt";
	$mail->FromName = "ArguQuest";
	$mail->SMTPSecure = 'tls';
	$mail->IsHTML(true); // send as HTML


	//Titulo do e-mail que ser� enviado
	$mail->Subject  =   $subject;

	//Preenchimento do campo FROM do e-mail
	$mail->From = $mail->Username;
	$mail->FromName = "ArguQuest";

	//E-mail para a qual o e-mail ser� enviado
	$mail->AddAddress($to);

	//Conte�do do e-mail
	$mail->Body = $message;
	$mail->AltBody = $mail->Body;

	//Dispara o e-mail
	$enviado = $mail->Send();

	//Imprime sucesso.
	if($enviado) return true;
	else return false;
}